@model NavigatorBarModel
@{
    ViewBag.Title = "用户管理";
    Layout = "_Default";
}
@section javascript {
    <script src="~/js/users.js" asp-append-version="true"></script>
}
@section query {
    <form class="form-inline">
        <div class="row">
            <div class="form-group col-12">
                <label class="control-label" for="txt_search_name">登录名称</label>
                <input type="text" class="form-control" id="txt_search_name" maxlength="16" data-default-val="" />
            </div>
            <div class="form-group col-12">
                <label class="control-label" for="txt_display_name">显示名称</label>
                <input type="text" class="form-control" id="txt_display_name" maxlength="20" data-default-val="" />
            </div>
        </div>
    </form>
}
@section toolbar {
    <button id="btn_assignGroup" type="button" class="btn btn-info" asp-auth="assignGroup">
        <i class="fa fa-bank" aria-hidden="true"></i><span>分配部门</span>
    </button>
    <button id="btn_assignRole" type="button" class="btn btn-warning" asp-auth="assignRole">
        <i class="fa fa-sitemap" aria-hidden="true"></i><span>分配角色</span>
    </button>
}
@section gear {
    <a id="tb_assignRole" href="#" title="分配角色"><i class="fa fa-sitemap" asp-auth="assignGroup"></i></a>
    <a id="tb_assignGroup" href="#" title="分配部门"><i class="fa fa-bank" asp-auth="assignRole"></i></a>
}
@section tableButtons {
    <button class="reset btn btn-warning" asp-auth="resetPassword"><i class="fa fa-remove"></i><span>重置</span></button>
}
@section cardbody {
    <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
        <span>演示系统禁止修改系统内置账户（Admin、User）</span>
    </div>
}
@section modal {
    <div class="modal-header">
        <h5 class="modal-title" id="myModalLabel">用户编辑窗口</h5>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    </div>
    <div class="modal-body">
        <form class="form-inline">
            <input type="hidden" id="userID" />
            <div class="row">
                <div class="form-group col-sm-6">
                    <label class="control-label" for="userName">登录名称</label>
                    <input type="text" class="form-control" id="userName" placeholder="不可为空，16字以内" minlength="3" maxlength="16" userName="true" remote="api/Register" data-remote-msg="此用户已存在" data-valid="true" />
                </div>
                <div class="form-group col-sm-6">
                    <label class="control-label" for="displayName">显示名称</label>
                    <input type="text" class="form-control" id="displayName" placeholder="不可为空，20字以内" maxlength="20" data-valid="true" />
                </div>
                <div class="form-group col-sm-6">
                    <label class="control-label" for="password">登录密码</label>
                    <input type="password" class="form-control" id="password" placeholder="不可为空，16字以内" maxlength="16" autocomplete="off" data-valid="true" />
                </div>
                <div class="form-group col-sm-6">
                    <label class="control-label" for="confirm">确认密码</label>
                    <input type="password" class="form-control" id="confirm" placeholder="与登录密码一致" maxlength="16" equalTo="#password" autocomplete="off" data-valid="true" />
                </div>
            </div>
        </form>
    </div>
}
@await Html.PartialAsync("RoleConfig")
@await Html.PartialAsync("GroupConfig")
<div class="modal fade" id="dialogReset" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myResetModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
        <div class="modal-content" data-toggle="LgbValidate" data-valid-button="#btnReset" data-valid-modal="#dialogReset">
            <div class="modal-header">
                <h5 class="modal-title" id="myResetModalLabel">重置密码窗口</h5>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            </div>
            <div class="modal-body">
                <form class="form-inline">
                    <div class="form-row" id="resetForm">
                        <div class="form-group col-sm-6">
                            <label class="control-label" for="password">登录密码</label>
                            <input type="password" class="form-control" id="resetPassword" placeholder="不可为空，16字以内" maxlength="16" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="control-label" for="confirm">确认密码</label>
                            <input type="password" class="form-control" id="resetConfirm" placeholder="与登录密码一致" maxlength="16" equalTo="#resetPassword" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-12">
                            <label class="control-label" for="resetReason">重置原因</label>
                            <textarea class="form-control flex-sm-fill" id="resetReason" rows="3" readonly="readonly" maxlength="200"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">
                    <i class="fa fa-times"></i>
                    <span>关闭</span>
                </button>
                <button type="button" class="btn btn-primary" id="btnReset">
                    <i class="fa fa-save"></i>
                    <span>保存</span>
                </button>
            </div>
        </div>
    </div>
</div>
